#include <stdio.h>
#include <stdlib.h>

typedef struct Student Student;
struct Student {
  int id;
  char *name;
  char *gender;
  double score;
};

int main(int argc, char *argv[]) {
  /* 结构体数组
   */
  printf("请输入学生的个数：");
  int count;
  scanf("%d", &count);
  Student *students = (Student *)malloc(sizeof(Student) * count);
  double sum = 0.0;
  for (int i = 0; i < count; i++) {
    printf("请输入第 %d 个学生的信息：\n", i + 1);
    printf("id = ");
    scanf("%d", &students[i].id);
    printf("name = ");
    students[i].name = malloc(sizeof(char *));
    scanf("%s", students[i].name);
    students[i].gender = malloc(sizeof(char *));
    printf("gender = ");
    scanf("%s", students[i].gender);
    printf("score = ");
    scanf("%lf", &students[i].score);
    sum += students[i].score;
  }
  double average = sum / count;
  for (int i = 0; i < count; i++) {
    if (students[i].score > average) {
      printf("name = %s\tscore = %lf\n", students[i].name, students[i].score);
    }
  }
  return EXIT_SUCCESS;
}
